include_directories(
    ${CMAKE_CURRENT_SOURCE_DIR}
)

set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -lm")

# stress-queue-pop
set(CDSSTRESS_QUEUE_POP stress-queue-pop)
set(CDSSTRESS_QUEUE_POP_SOURCES
    ../main.cpp
    pop.cpp
)
add_executable(${CDSSTRESS_QUEUE_POP} ${CDSSTRESS_QUEUE_POP_SOURCES})
target_link_libraries(${CDSSTRESS_QUEUE_POP} ${CDS_TEST_LIBRARIES} ${CDSSTRESS_FRAMEWORK_LIBRARY})
strip_binary(${CDSSTRESS_QUEUE_POP})
add_test(NAME ${CDSSTRESS_QUEUE_POP} COMMAND ${CDSSTRESS_QUEUE_POP} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})    

# stress-queue-push
set(CDSSTRESS_QUEUE_PUSH stress-queue-push)
set(CDSSTRESS_QUEUE_PUSH_SOURCES
    ../main.cpp
    push.cpp
)
add_executable(${CDSSTRESS_QUEUE_PUSH} ${CDSSTRESS_QUEUE_PUSH_SOURCES})
target_link_libraries(${CDSSTRESS_QUEUE_PUSH} ${CDS_TEST_LIBRARIES} ${CDSSTRESS_FRAMEWORK_LIBRARY})
strip_binary(${CDSSTRESS_QUEUE_PUSH})
add_test(NAME ${CDSSTRESS_QUEUE_PUSH} COMMAND ${CDSSTRESS_QUEUE_PUSH} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})    

# stress-queue-push-pop
set(CDSSTRESS_QUEUE_PUSHPOP stress-queue-push-pop)
set(CDSSTRESS_QUEUE_PUSHPOP_SOURCES
    ../main.cpp
    push_pop.cpp
    intrusive_push_pop.cpp    
)
add_executable(${CDSSTRESS_QUEUE_PUSHPOP} ${CDSSTRESS_QUEUE_PUSHPOP_SOURCES})
target_link_libraries(${CDSSTRESS_QUEUE_PUSHPOP} ${CDS_TEST_LIBRARIES} ${CDSSTRESS_FRAMEWORK_LIBRARY})
strip_binary(${CDSSTRESS_QUEUE_PUSHPOP})
add_test(NAME ${CDSSTRESS_QUEUE_PUSHPOP} COMMAND ${CDSSTRESS_QUEUE_PUSHPOP} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})    

# stress-queue-random
set(CDSSTRESS_QUEUE_RANDOM stress-queue-random)
set(CDSSTRESS_QUEUE_RANDOM_SOURCES
    ../main.cpp
    random.cpp
)
add_executable(${CDSSTRESS_QUEUE_RANDOM} ${CDSSTRESS_QUEUE_RANDOM_SOURCES})
target_link_libraries(${CDSSTRESS_QUEUE_RANDOM} ${CDS_TEST_LIBRARIES} ${CDSSTRESS_FRAMEWORK_LIBRARY})
strip_binary(${CDSSTRESS_QUEUE_RANDOM})
add_test(NAME ${CDSSTRESS_QUEUE_RANDOM} COMMAND ${CDSSTRESS_QUEUE_RANDOM} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})    

# stress-queue-bounded
set(CDSSTRESS_QUEUE_BOUNDED stress-queue-bounded)
set(CDSSTRESS_QUEUE_BOUNDED_SOURCES
    ../main.cpp
    bounded_queue_fulness.cpp
)
add_executable(${CDSSTRESS_QUEUE_BOUNDED} ${CDSSTRESS_QUEUE_BOUNDED_SOURCES})
target_link_libraries(${CDSSTRESS_QUEUE_BOUNDED} ${CDS_TEST_LIBRARIES} ${CDSSTRESS_FRAMEWORK_LIBRARY})
strip_binary(${CDSSTRESS_QUEUE_BOUNDED})
add_test(NAME ${CDSSTRESS_QUEUE_BOUNDED} COMMAND ${CDSSTRESS_QUEUE_BOUNDED} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})    

# stress-spsc-queue
set(CDSSTRESS_SPSC_QUEUE stress-spsc-queue)
set(CDSSTRESS_SPSC_QUEUE_SOURCES
    ../main.cpp
    spsc_queue.cpp
    spsc_buffer.cpp
)
add_executable(${CDSSTRESS_SPSC_QUEUE} ${CDSSTRESS_SPSC_QUEUE_SOURCES})
target_link_libraries(${CDSSTRESS_SPSC_QUEUE} ${CDS_TEST_LIBRARIES} ${CDSSTRESS_FRAMEWORK_LIBRARY})
strip_binary(${CDSSTRESS_SPSC_QUEUE})
add_test(NAME ${CDSSTRESS_SPSC_QUEUE} COMMAND ${CDSSTRESS_SPSC_QUEUE} WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH})


# stress-queue
add_custom_target( stress-queue
    DEPENDS
        ${CDSSTRESS_QUEUE_POP}
        ${CDSSTRESS_QUEUE_PUSH}
        ${CDSSTRESS_QUEUE_PUSHPOP}
        ${CDSSTRESS_QUEUE_RANDOM}
        ${CDSSTRESS_QUEUE_BOUNDED}
        ${CDSSTRESS_SPSC_QUEUE}
)        